diff options
| author | Adam Soltys <[email protected]> | 2022-08-29 17:36:12 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-08-29 17:36:12 -0700 |
| commit | 2f11cdc8e6f885089d4832b26e7dd78ad86eca45 (patch) | |
| tree | 5ef562302eba3515df906e6aed1fde71642cf368 /src/routes/[username]/settings/_pos.svelte | |
| parent | 8d09fd39f2701dbc0853f9f364eb729c67cfef5d (diff) | |
| download | coinos-ui-2f11cdc8e6f885089d4832b26e7dd78ad86eca45.tar.gz coinos-ui-2f11cdc8e6f885089d4832b26e7dd78ad86eca45.zip | |
refactor settings page
Diffstat (limited to 'src/routes/[username]/settings/_pos.svelte')
| -rw-r--r-- | src/routes/[username]/settings/_pos.svelte | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/routes/[username]/settings/_pos.svelte b/src/routes/[username]/settings/_pos.svelte new file mode 100644 index 00000000..ed204549 --- /dev/null +++ b/src/routes/[username]/settings/_pos.svelte @@ -0,0 +1,36 @@ +<svelte:options accessors={true} /> + +<script> + import { rates, user } from '$lib/store'; + import { Icon, Toggle, LocaleSelector } from '$comp'; + import { t } from '$lib/translations'; + + const fiats = Object.keys($rates); + + const updateFiat = async (e) => { + try { + $user.currency = e.target.value; + let r = await put('/' + $user.username, { user: $user }); + success('Local currency updated!'); + } catch (e) { + failure(e.message); + } + }; +</script> + +<div> + <label for="currency" class="font-bold block mb-1">{$t('user.settings.localCurrency')}</label> + <select name="currency" on:change={updateFiat} class="block py-3 w-full"> + {#each fiats as fiat} + <option value={fiat} selected={$user.currency === fiat}>{fiat}</option> + {/each} + </select> +</div> + +<div> + <label for="btc-unit" class="font-bold block mb-1">{$t('user.settings.btcUnit')}</label> + <select disabled name="btc-unit" class="block py-3 w-full"> + <option value="SATS">{$t('user.settings.satoshis')} (SAT)</option> + <option value="BTC">{$t('user.settings.bitcoin')} (BTC)</option> + </select> +</div> |
